package org.acme.controller;

import org.acme.po.SysUser;
import org.acme.service.SysUserService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.UUID;

@RestController
public class SysUserController {

    @Resource
    private SysUserService sysUserService;


    @RequestMapping(value = "add")
    public SysUser add() {
        SysUser sysUser = new SysUser();
        sysUser.setName(UUID.randomUUID().toString());
        sysUser.setAge(10);
        sysUserService.save(sysUser);
        return sysUser;
    }

    @RequestMapping(value = "list")
    public List<SysUser> list() {
        return sysUserService.list();
    }
}
